home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
asm_n_z.zip
/
RES86A.ASM
< prev
next >
Wrap
Assembly Source File
|
1985-08-02
|
44KB
|
2,367 lines
title 'RES86 DISASSEMBLER'
page 60,132
;
; last edit 02/10/85 wde
; 2/10/85 2.3b fix goof in read .ctl funct
; fix flow indic semic test,repair 8080 sym lookup
; fix sym type write bug
; 1/17 2.3a add fixes from b kendall
; 3/21/85 3.0 convert to masm format for ms-dos systems by Craig Derouen
code segment byte public
extrn cntenb:byte,opdtyp:byte,quiflg:byte,segflg:byte,segmsk:byte
extrn segsho:byte,sdflg:byte,trmflg:byte,typndx:byte,wfiflg:byte
extrn wrtflg:byte,xcsw:byte,adb:byte,strcnt:byte,symtyp:byte
extrn ascbld:word,cofset:word,ctlbas:word,ctltop:word,curofs:word
extrn curpar:word,dmpcnt:word,dmpend:word,dmpstt:word,docend:word
extrn doctbl:word,ecnt:word,fndadd:word,fndpc:word,hiload:word
extrn insloc:word,lastwd:word,liscnt:word,mcbsiz:word,ofsptr:word
extrn nrsegs:word,nxtctl:word,pcntr:word,rplptr:word,segsiz:word
extrn stack:word,symtp:word,xcptr:word,cmdbuf:word
extrn segnam:word,mcbbas:word,fake_comtbl:word
extrn addfn:near,bdos:near,cmentr:near,cmkill:near
extrn creatf:near,cstbl:near,crlf:near,dline:near
extrn dcrlf:near,fclose:near,fopen:near,gtcmd:near,gtval:near
extrn hexl:near,hexr:near,ifasci:near,initbl:near
extrn keychk:near,lita86:near,litall:near,litcmd:near,litctl:near
extrn litdoc:near,litsym:near,lngth:near,locsym:near,prntde:near
extrn prtstr:near,prspc:near,prword:near,pstar:near,pstrg:near
extrn rdfchr:near,semic:near,symbas:near,symluk:near
extrn tabc:near,typech:near,wtfchr:near,xo:near,xo0:near,flushf:near
extrn cmpstr:near,pstg:near
public start,hsym,nwln0,delim,cmerr,nxcmd
public fcb,tbuf
; dummy publics for symbol file
public entry,ardnam,restrt,l01cf,funlp,fndfun,segonl,fcttbl,fctend
public deliok,cmhelp,cmtrim,trmof,cmpurg,l02c9,cmprlg,l02df,pfnlp
public nofnam,pnmdun,l031d,prlglp,l032c,l033d,l034b,l0362,l0380,l0394
public nodisp,sgreqs,updseg,segmch,segmtb,cmqiet,l03b2,cmdump,l0411
public l0418,dump0,dump1,dump3,dmphdr,cntdmp,dump4,dmpln,wdspc1
public wdspc2,wdspc3,dmpasc,period,chrctr,wdspc4,lcmplt,sducnt,l04e8
public l04ef,dusymt,frmbgn,frmsym,agnsym,l051a,spit,spit1,spitcr,spcrlf
public spcry,iecnt,prntos,gfnam,l056a,l057d,nodriv,mvnfld
public eatfld,l05b6,padfld,cmatmt,cmbld,cmlist,list1,list2,list3
public tenl,contl,flagck,builda,loop8,follow,morel,nwln,ncsemi,cntcmt
public ntbksl,morel1,morel2,ncmt,cml15,l06fd,ckbmd,ckhmd,ckwmd,badmd,ictl
public slicnt,l0762,l0776,l077d,dsmode,wmode,stpln,hmode,bmode,bmode1
public nprtc,morinv,ltlf,mvup,trysym,nstpln,l0864,nxinv,conasc,morasc
public l08ac,yet,still,lastqt,fnlqt,qtb,cmstts,nodoct,l0984,sgplp
public usdseg,sgpen,prwval,cmfind,l09c6,l09d1,prevf,nyet
public cmeof,l0a35,cmread,rdaprv,wntall,lodall,chgtyp,ntlall,symffd
public l0a8a,wntcmd,lodcmd,cmdlds,modofs,cmhlp,cmhmlp,set_dmablk
public mrqok,l0ac4,l0adc,l0aec,doclod,gotdoc,lodsym,comrd_lp
public ldsym2,loddoc,lddoc2,ldasfl,skppre,l0b6c,drdsk1,lpasld,ldassp
public hexbin,l0ba3,l0ba8,l0baf,l0bb5,erstbl,etlp1,etlp2,cmsave
public savok,allsav,nosdoc,nossym,havctl,ntsall,ntssym,ntsctl,symsav
public l0bf4,l0bf7,sdskp1,l0c0c,oufend,ntsdoc,outadr,sava86,savdoc
public rrqerr,l0d20,cmctl,l0d45,l0d4f,l0d5a,enterc,entrc2,entrc4
public l0d84,l0dba,l0dc6,cltrck,ctlck2,cltrrt,l0bf5,entrc5,entrc7
public entrc8,l0e34,ctlook,ctlk2,l0e4s,l0e5c,l0e48,ctlk4,l0e65,clist0
public clist,clist2,l0e87,l0e99,skclis,savctl,svctl0,l0ebf,l0ee6
public lodctl,ctlfnd,l0ef7,l0efd,l0f0b,l0f23,l0f30,cmcmnt,cmnt0,cmnt2
public cmnt1,l0f52,l0f5d,l0f71,l0f7d,comchk,l0fa6,l0fb2,l0fc3,l0fce
public l0fd4,l0fd8,l0fec,l0ffa,l100b,l1015,l1023,l1041,l104c,cmusec
public l10ce,ustok,uaset,l10ef,l111c,l1151,l1152,good_vers,good_mem
assume cs:code,ds:code
org 5ch
fcb db 36 dup (?)
tbuf db 128 dup(?) ;that takes care of the first page
symmax equ 9 ;max chars in symbol
tab equ 9
cr equ 0dh
lf equ 0ah
initlcnt equ 20
;
org 100h
if2
%out Compiling in PASS 2 finally!
endif
start:
mov ah,30h
int 21h
cmp al,2
jae good_vers
mov dx,offset bad_vers
mov ah,9
int 21h
int 20h ; back to DOS!
bad_vers db cr,lf,7,'Wrong version of DOS! Must be 2.0 or higher$'
good_vers:
; First thing is to de-allocate memory so we can grab portions at a time.
mov bx,offset symbas ; the end of program
sub bx,100h ; start of program
mov cl,4
shr bx,cl ; convert to paras!
; Now add about 10k for symbol table
add bx,640 ; 10K in paras
mov ah,4ah
; int 21h ; here we go!
; jnc good_mem ; we have enough!
; mov ah,9
; mov dx,offset memory_fail
; int 21h
; mov ax,4cffh
; int 21h ; exit with a -1
;
;memory_fail db cr,lf,7,'Not enough memory to run!$'
good_mem:
call entry
db 'RESOURCE by Ward Christensen',cr,lf
db 'Transl. to 8086 by Larry Etienne',cr,lf
db 'Converted 8086 MS-DOS Ver. 3.0',cr,lf
db 'by C.Derouen (3-26-85)',cr,lf
db 'Copyright 1980$'
;
entry: pop dx
mov ax,ds
cli
mov ss,ax
mov sp,offset stack
sti
mov es,ax ;start = data seg
push cs
pop ds ;segment for signon msg
mov ah,9
call bdos
mov ax,ss
mov ds,ax ;restore normal
call initbl
mov al,fcb+1
cmp al,' '+1
jb restrt
call prtstr
db cr,lf,'Reading All Files for ',0
mov bx,offset fcb+1
mov ch,8
ardnam: mov al,[bx]
call typech
inc bx
dec ch
jnz ardnam
call lodall
call prtstr
db cr,lf,'Read Complete',cr,lf,0
jmp short fstcmd
;
restrt: call initbl
fstcmd: call prtstr
db cr,lf,'Type H for Help, ? for Stats',cr,lf,0
;
nxcmd: xor al,al
mov wfiflg,al
mov quiflg,al ;not quiet, no output
mov segflg,al ;clear segment use
mov sp,offset stack
call gtcmd
l01cf: mov bx,offset cmdbuf+2 ;first chars of command
cmp word ptr 1[bx],':S'
jz segonl ;just change segment
mov al,[bx] ;get the char
mov bx,offset fcttbl
mov ch,(offset fctend-offset fcttbl)/3 ;tbl entries
funlp: cmp al,cs:[bx] ;test char match
jz fndfun
inc bx
inc bx
inc bx
dec ch
jnz funlp
jmp cmerr
;
fndfun: inc bx
mov dx,cs:[bx] ;address of function
jmp dx
;
segonl: inc bx ;pre-adj
call updseg
jmp short nxcmd
;
fcttbl db cr
dw offset nxcmd
db ';'
dw offset cmcmnt
db 'A'
dw offset cmatmt
db 'B'
dw offset cmbld
db 'C'
dw offset cmctl
db 'D'
dw offset cmdump
db 'E'
dw offset cmentr
db 'F'
dw offset cmfind
db 'G'
dw offset cmexit
db 'H'
dw offset cmhelp
db 'K'
dw offset cmkill
db 'L'
dw offset cmlist
; db 'O'
; dw offset cmofst
db 'P'
dw offset cmprlg
db 'Q'
dw offset cmqiet
db 'R'
dw offset cmread
db 'S'
dw offset cmsave
db 'T'
dw offset cmtrim
db 'U'
dw offset cmusec
db 'X'
dw offset cmpurg
db 'Z'
dw offset cmeof
db '?'
dw offset cmstts
fctend db 0
;
cmerr: xor al,al
mov wfiflg,al
mov quiflg,al ;clear output and silent flags
pop bx ;addr called from
push bx ;in case stack empty
call prword ;show where for debugging
call prtstr
db '? Cmd. Error',7,cr,lf,0
jmp nxcmd
;
delim: cmp al,' '
jz deliok
cmp al,','
jz deliok
call cmerr ;expected delimiter missing
deliok: ret
; Exit resource here
cmexit:
mov ax,4c00h ; say no errors
int 21h
;
; help function
;
cmhelp:
; Test to see if extended help is needed.
mov al,byte ptr cmdbuf+3
cmp al,cr ; nothing there?
je full_help
cmp al,'X' ; help extended key
jne full_help
jmp extnd_help ; show extended help
full_help:
call prtstr ;lots to put out here!
;line 1
db cr,lf,' HELP ON RES86 -- COMMAND SUMMARY'
;line 2
db cr,lf,';ADDR,@COMMENT ENTER COMMENT AT ADDR '
db ' @={;|*|\|} \=NL, ;=APPND, *=REPL INST'
;line 3
db cr,lf,'; LIST COMMENTS TABLE '
db ';ADDR, DELETE COMMENT'
;line 4
db cr,lf,"A (SEE L) ATTEMPT TO FIND DB'",'S '
db 'B (SEE L) BUILD SYMBOL TABLE'
;line 5
db cr,lf,'C DUMP CONTROL TABLE '
db 'CNNNN DUMP CTRL TABLE AT NNNN'
;line 6
db cr,lf,'CNNNN,X SET CTRL (X=BEHISW) '
db 'DNNNN DUMP FROM NNNN ON'
;line 7
db cr,lf,'DAAAA,BBBB DUMP OVER RANGE '
db 'D,BBBB DUMP THRU BBBB'
;line 8
db cr,lf,'D DUMP A PAGE MORE '
db 'D=NN SET DUMP SIZE DEFAULT'
;line 9
db